package leetcode.weekly.week336;

import java.util.Arrays;

//Solution2Test
public class Solution2 {

	public int maxScore(int[] nums) {
		Arrays.sort(nums);
		int ans = 0;
		long s = 0;
		for (int i = nums.length; i > 0; i--) {
			s += 1l * nums[i - 1];
			if (s > 0) {
				ans++;
			}
		}
		return ans;
	}

}
